import React from 'react';
import {Image, StyleSheet, TouchableOpacity, Alert, ToastAndroid, AsyncStorage} from 'react-native';
import {TabNavigator} from "react-navigation";
import utils from './../utils/utils';
import Index from "./index/Index";
import New from "./new/New";
import Shop from "./shop/Shop";
import ShopCar from "./shop-car/ShopCar";
import My from "./my/My";

const MainTab = TabNavigator({
        IndexTab: {
            screen: Index,
            navigationOptions: {
                tabBarLabel: '首页',
                tabBarIcon: ({tintColor, focused}) => (
                    focused ?
                        <Image style={styles.tabIcon} resizeMode='contain' source={require('../../img/main_select3x.png')}/>
                        :
                        <Image style={styles.tabIcon} resizeMode='contain' source={require('../../img/main_no3x.png')}/>
                ),
                header: null,
            }
        },
        NewTab: {
            screen: New,
        },
        ShopTab: {
            screen: Shop,
        },
        ShopCarTab: {
            screen: ShopCar,
        },
        MyTab: {
            screen: My,
        },
    },
    {
        tabBarPosition: 'bottom',
        lazy: false, // 是否懒加载
        initialRouteName: 'IndexTab',
        swipeEnabled: false,
        animationEnabled: true,
        tabBarOptions: {
            showIcon: true,
            showLabel: true,
            indicatorStyle: {
                height: 0  // 如TabBar下面显示有一条线，可以设高度为0后隐藏
            },
            style: {
                height: utils.autoheight(49),
                backgroundColor: '#ffffff',
                borderTopWidth: utils.autoWidth(1),
                borderColor: '#B2B2B2',
            },
            labelStyle: {
                fontSize: utils.setSpText(10),
                color: '#040404',
                marginTop: -utils.autoheight(2),
            },
            tabStyle: {
                backgroundColor: '#F6F6F6',
            },
        },
    });

const styles = StyleSheet.create({
    tabIcon: {
        height: utils.autoWidth(23),
        width: utils.autoWidth(27),
    },

});
export default MainTab;